import React from 'react'
import Tit from '../../components/Tit'
import './PayClass.less'
export default class PayClass extends React.Component {
    state = {
        payDat: 2
    }
    Pay() {
        console.log(this.props.match.params.id)
        this.$postData('/api/payApi/phonePayOrder', { orderNo: this.props.match.params.id, payType: this.state.payDat, type: 1, platformType: 2 }, (params) => {
            console.log(params)
            const newWindow = window.open("", "_self");
            newWindow.document.write(params.data);
            newWindow.focus();
        })
    }
    render() {
        return (
            <div className='PayClass'>
                <Tit zz={true} tit={'请选择支付方式'}></Tit>
                <div className='PayClass-d1' onClick={() => { this.setState({ payDat: 2 }) }}>
                    <img src={require('../../static/img/wechat.png')} alt="" />
                    <p>微信支付</p>
                    {this.state.payDat === 2 ? <img src={require('../../static/img/yuan-hov.png')} alt="" /> : <img src={require('../../static/img/yuan.png')} alt="" />}
                </div>
                <div className='PayClass-d1' onClick={() => { this.setState({ payDat: 1 }) }}>
                    <img src={require('../../static/img/allpy.png')} alt="" />
                    <p>支付宝支付</p>
                    {this.state.payDat === 1 ? <img src={require('../../static/img/yuan-hov.png')} alt="" /> : <img src={require('../../static/img/yuan.png')} alt="" />}
                </div>
                <p className='center PayClass-d2' onClick={this.Pay.bind(this)}>
                    确定</p>
            </div>
        )
    }
} 